<?php
/**
 * Created by 项目.
 * User: xuguopeng
 * Date: 2019-11-25
 * Time: 16:41
 * banner信息主表
 */

namespace app\api\model;


class Banner extends BaseModel
{
    protected $hidden = ['id','delete_time','update_time'];
    // 关联
    public function items()
    {
        return $this->hasMany('BannerItem','banner_id','id')->order('order_sort desc');
    }

    /**
     * 根据ID获取对应的banner列表
     */
    public static function getBannerId($id)
    {
        $banner = self::with(['items','items.img'])->find($id);
        return $banner;
    }
}